<#include "../commons/header.ftl">
<@header title="我的测试">
    <!-- CSS -->
    <link rel='stylesheet' href='http://fonts.googleapis.com/css?family=PT+Sans:400,700'>
    <link rel="stylesheet" href="/css/reset.css">
    <link rel="stylesheet" href="/css/supersized.css">
    <link rel="stylesheet" href="/css/style.css">

    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
        <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

<!-- Javascript -->
<script src="/js/jquery-1.8.2.min.js" type="text/javascript"></script>
<script src="/js/supersized.3.2.7.min.js" type="text/javascript"></script>
<script src="/js/supersized-init.js" type="text/javascript"></script>
<script src="/js/scripts.js" type="text/javascript"></script>
<script type="text/javascript" src="/js/layer/layer.js"></script>

</@header>
        <div class="container" id="container">
            <div class="page-container">
                <h1>登录</h1>
                <form id="loginForm" >
                    <input type="text" name="username" class="username" placeholder="Username">
                    <input type="password" name="password" class="password" placeholder="Password">
                    <button type="button" id="loginSubmit" >登录</button>
                    <button type="button" id="regist" class="btn btn-success">没有账号注册</button>
                    <div class="error"><span></span></div>
                </form>
            </div>
        </div>

<script type="text/javascript">

    $('#loginSubmit').click(
            function () {
                $.ajax({
                    cache: true,
                    type: "POST",
                    url:"${basePath}/login",
                    data:$('#loginForm').serialize(),
                    async: false,
                    error: function() {
                        layer.msg("服务异常",{icon:2});
                    },
                    success: function(data) {
                        if(data.bizCode=="1"){
                            window.location = "${basePath}/adminIndex";
                        }else {
                            layer.alert(data.bizDesc,{icon:2});
                        }

                    }
                });
            }
    );

    $('#regist').click(
        function () {
            var div = "#container";
            $.ajax({
                url:"${basePath}/registIndex",//默认加载list 页面
                data:{},
                error:function(){
                     layer.msg('通信失败', {icon:2});
                 },
                dataType:'html',
                type: "POST",
                contentType:"application/x-www-form-urlencoded; charset=utf-8",
                success: function(data){
                    $(div).empty();
                    $(div).html(data);
                    $(div).hide();
                    $(div).fadeIn(300);
                }
            });
        }

    );



</script>


